<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <button id="h2">开始跑起来！</button>
  <img src="other_emotion_gate_1.png"/>
  <script>
    window.onload = function(){
      let h2 = document.querySelector("button")
      let img = document.querySelector("img")

      h2.onclick = function(){
        changeImg()
      }
      function changeImg(){
        let timer = null
        let i = 1
        timer = window.setInterval(()=>{
          console.log(i);
          let src = `other_emotion_gate_${i}.png`;
          img.src = src;
          if(i>=24){
            window.clearInterval(timer)
          }else{
            i++
          }
        },100)
      }
    }
  </script>
</body>
</html>